import { FormInstance } from 'antd';
import React from 'react';
import { Dispatch } from 'react';
import { AssetacquisitionManageAPI } from '../common/type';

interface AcquisitionTableTypes {
  dataSource: Record<string, any>[]; //表格数据
  loading: boolean; // 加载
  mapList: Record<string, any>;
  pagination: Record<string, any>; //分页参数
  otherParams: Record<string, any>; //当前请求参数
  searchList: AssetacquisitionManageAPI.ISearchList;
  reloadTableData: () => void; // 重置
  [key: string]: any;
}
interface UpdateAddOrEdit {
  addContractRun: (resObj: Record<string, any>) => void;
  editContractRun: (resObj: Record<string, any>) => void;
}

/** 合同管理页面上下文类型 */
export interface IContractContextAPI {
  rightTableProps: AcquisitionTableTypes; //表格数据参数
  curRes: Record<string, any>;
  materielList: any; // 选中的物料信息
  acquisitionDispatch: Dispatch<any>;
}

/** 合同管理上下文 */
const INIT_CONTRACTCONTEXT_VALUE: IContractContextAPI = {
  rightTableProps: {
    dataSource: [
      {
        id: '100000000151',
        createDepartmentName: '科技创新部',
        applyTitle: '转移申请1',
        applyInfo: '领用申请',
        applyFile: '',
        applyState: 0,
        workflowID: '111100000151',
        applyStateName: '起草',
        checkStateName: '审批中',
        applyStartTime: '2023-12-27',
        applyEndTime: '2023-12-28',
        originalDepartmentName: '北京市顺义区大仓库',
        newDepartmentName: '北京市怀柔区仓库',
        ownerName: '超级管理员',
        oldStore: '北京市宣武区宣函路仓库',
        nowStore: '北京市怀柔区怀柔实验室仓库',
      },
      {
        id: '100000000152',
        createDepartmentName: '怀柔试验工作室',
        applyTitle: '转移申请2',
        applyInfo: '2023-04-10-行政部资产领用申请',
        applyFile: '',
        applyState: 1,
        workflowID: '111100000152',
        applyStateName: '审批通过',
        checkStateName: '审批中',
        originalDepartmentName: '北京市丰台区大仓库',
        newDepartmentName: '北京市怀柔区仓库',
        applyStartTime: '2023-12-27',
        applyEndTime: '2023-12-28',
        ownerName: '资管员',
        oldStore: '北京市宣武区宣函路仓库',
        nowStore: '北京市怀柔区怀柔实验室仓库',
      },
    ],

    loading: false,
    getAcquisitionTableData: ({}) => {},
    mapList: [],
    pagination: {},
    otherParams: {},
    searchList: [],
    reloadTableData: () => {},
  },
  curRes: {},
  acquisitionDispatch: () => {},
  materielList: [],
};

const AssetDiscardContext = React.createContext<IContractContextAPI>(INIT_CONTRACTCONTEXT_VALUE);

export { AssetDiscardContext };
